//
//  SearchDeviceView.m
//  JunZeWristband
//
//  Created by Kendama on 2017/9/1.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "SearchDeviceView.h"

@implementation SearchDeviceView

- (void)startAnimation
{
    CABasicAnimation* rotationAnimation;
    rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.fromValue = [NSNumber numberWithFloat: -M_PI * 2.0 ];
    rotationAnimation.duration = 1.5;
    rotationAnimation.cumulative = YES;
    rotationAnimation.repeatCount = 100;
    [self.circleImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}

- (void)stopAnimation
{
    
}

- (UIImageView *)circleImageView
{
    if(!_circleImageView)
    {
        UIView *superView = self;
        _circleImageView = [[UIImageView alloc]init];
        [superView addSubview:_circleImageView];
        _circleImageView.image = [UIImage imageNamed:@"search_circle"];
    }
    return _circleImageView;
}
- (UILabel *)tipLabel
{
    if(!_tipLabel)
    {
        UIView *superView = self;
        _tipLabel = [[UILabel alloc]init];
        [superView addSubview:_tipLabel];
        [_tipLabel setFont:[UIFont systemFontOfSize:15]];
        [_tipLabel setTextColor:[UIColor grayColor]];
        _tipLabel.text = @"正在搜手环，请将手环靠近手机~";
    }
    return _tipLabel;
}


- (void)masLayoutSubview
{
    __weak UIView *superView = self;
    [self.circleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(px1920Height(250));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
    
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.circleImageView.mas_bottom).with.offset(px1920Height(110));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
}

@end
